! ===================================================================
      SUBROUTINE DataImport()
!     Global variables
      USE DCMD_CMOD

      INTEGER*4 I, J
      REAL*8 ComVars(2,8), GeoParas(2,4), MemProps(6), StmProps(2,4)
      
      OPEN(UNIT = 1, FILE = 'ComVars.dat', ACTION = 'READ')
      OPEN(UNIT = 2, FILE = 'GeoParas.dat', ACTION = 'READ')
      OPEN(UNIT = 3, FILE = 'MemProps.dat', ACTION = 'READ')
      OPEN(UNIT = 4, FILE = 'StmProps.dat', ACTION = 'READ')
      
      DO I = 1, 2
        READ(1, 1001) (ComVars(I,J), J = 1, 8)
        READ(2, 1002) (GeoParas(I,J), J = 1, 4)
        READ(4, 1004) (StmProps(I,J), J = 1, 4)
      END DO
      READ(3, 1003) (MemProps(I), I = 1, 6)
           
      CLOSE(UNIT = 1)
      CLOSE(UNIT = 2)
      CLOSE(UNIT = 3)
      CLOSE(UNIT = 4)
 
      WRITE(*, *) 'Read ComVars.dat successfully'
      WRITE(*, 1005) ((ComVars(I,J), J = 1, 3), I = 1, 2)
      WRITE(*, *) 'Read GeoParas.dat successfully'
      WRITE(*, 1002) ((GeoParas(I,J), J = 1, 4), I = 1, 2)
      WRITE(*, *) 'Read MemProps.dat successfully'
      WRITE(*, 1003) (MemProps(I), I = 1, 6)
      WRITE(*, *) 'Read StmProps.dat successfully'
      WRITE(*, 1004) ((StmProps(I,J), J = 1, 4), I = 1, 2)
      
      DO I = 1, 2
        COM_WIN(I) = ComVars(I,1)
        COM_TIN(I) = ComVars(I,2)
        COM_PIN(I) = ComVars(I,3)
        COM_ID(I) = GeoParas(I,1)
        COM_OD(I) = GeoParas(I,2)
        COM_DEQ(I) = GeoParas(I,3)
        COM_CSA(I) = GeoParas(I,4)
        COM_RHO(I) = StmProps(I,1)
        COM_MU(I) = StmProps(I,2)
        COM_LAMBDA(I) = StmProps(I,3)
        COM_CP(I) = StmProps(I,4)
        COM_VIN(I) = COM_WIN(I)/COM_RHO(I)/COM_CSA(I)
      END DO
      COM_NUM = MemProps(1)
      COM_LEN = MemProps(2)
      COM_THK = MemProps(3)
      COM_ALOC = MemProps(4)
      COM_PERM = MemProps(5)
      COM_COND = MemProps(6)

 1001 FORMAT(8E12.4)
 1002 FORMAT(4E12.4)
 1003 FORMAT(E12.4)
 1004 FORMAT(4E12.4)
 1005 FORMAT(3E12.4)

      
      END SUBROUTINE
